<?php
$conn = mysqli_connect('localhost', 'root', 'root', 'school') or die('连接失败');
$book_name = $_POST['book_name'];
$isbn = $_POST['isbn'];
$author = $_POST['author'];
$add = "insert into book values (null,'$book_name','$isbn','$author');";
$query = mysqli_query($conn, $add);
if (empty($query)){
    echo "<script>alert('新增失败！');location.href='".$_SERVER["HTTP_REFERER"]."';</script>";
}else{
    echo "<script>alert('新增成功！');location.href='".$_SERVER["HTTP_REFERER"]."';</script>";
}
